<template>
  <div v-loading="loading" class="Fxpg_details" element-loading-background="rgba(0, 0, 0, 0.4)">
    <div class="Fxpg_cur listTables">
      <div class=" RightCardTitle">基本情况 </div>
      <!-- <el-table
        :data="riskList.dangerGridList"
        style="width: 100%;padding-bottom: 20px;"
        class="tableFXPg"
        @row-click="clickRHCDRow"
      >
        <el-table-column align="center" prop="hOfHouse" label="户主" />
        <el-table-column align="center" prop="familfPNum" label="家庭人口" />
        <el-table-column align="center" prop="he" label="宅基高程(m)" />
        <el-table-column align="center" prop="area" label="房屋面积(m²)" />
      </el-table> -->
      <div class="tabel_common tabel_commons">
        <div class="table">
          <div class="thead">
            <div class="tr">
              <div class="th"> 户主 </div>
              <div class="th"> 家庭人口 </div>
              <div class="th"> 宅基高程(m) </div>
              <div class="th"> 房屋面积(m²) </div>
            </div>
          </div>
          <el-scrollbar style="height:54vh; width: 100%;" class="el_scrollbar">
            <div class="tbody">
              <template v-if="riskList && riskList.dangerGridList==null || riskList.dangerGridList.length <=0 ">
                <div slot="no-results" class="noData" style="background-position: center 85%;padding-top: 72%;">暂无数据</div>
              </template>
              <div  v-if="riskList  && riskList.dangerGridList && riskList.dangerGridList.length >0 " class="tr" v-for="(dict, index) in riskList.dangerGridList" :key="dict.hOfHouse"
                  @click="clickRHCDRow(dict, index)" :class="['tr', PionId == index ? 'ta' : '']">
                  <!-- :class="['tr', PionId == dict.id ? 'ta' : '']"> -->
                  <div class="td">
                    <el-tooltip class="item" effect="dark" :content="dict.hOfHouse" placement="top-start">
                      <span>{{ dict.hOfHouse }}</span>
                    </el-tooltip>  
                  </div>
                  <div class="td"> {{ dict.familfPNum }} </div>
                  <div class="td"> {{ dict.he }} </div>
                  <div class="td"> {{ dict.area }} </div>
              </div>
            </div>
          </el-scrollbar>
        </div>
      </div>
    </div>
    <!-- <div class="Submerge">
      <div><span>{{ riskList.dangerArea || 0 }}</span>危险区面积<br>(m²)</div>
      <div><span>{{ riskList.risk || 0 }}</span>风险点</div>
      <div><span>{{ riskList.dangerHNum || 0 }}</span>危险区户数<br>(户)</div>
      <div><span>{{ riskList.dangerPNum || 0 }}</span>危险区人口<br>(人)</div>
    </div> -->

    <div class=" riskInfo">
      <div class="riskInfo_item"> 
        <div></div>
        <div class="inner">
          <div class="num">{{ riskList.dangerArea || 0 }}</div>
          <div>危险区面积(m²)</div>
        </div>
      </div>
      <div class="riskInfo_item">
        <div></div>
        <div class="inner">
          <div class="num">{{ riskList.risk || 0 }}</div>
          <div>风险点</div>
        </div>
      </div>
      <div class="riskInfo_item">
        <div></div>
        <div class="inner">
          <div class="num">{{ riskList.dangerHNum || 0 }}</div>
          <div>危险区户数(户)</div>
        </div>
      </div>
      <div class="riskInfo_item">
        <div></div>
        <div class="inner">
          <div class="num">{{ riskList.dangerPNum || 0 }}</div>
          <div>危险区人口(人)</div>
        </div>
      </div>
    </div>
    
  </div>
</template>
<script>
import { GetDangerGrid } from '../../../api/xuna.js'
export default {
    data() {
        return {
            riskList: {},
            loading: false,
            organFdobj: {},
            PionId:undefined
        }
    },
    mounted() {

    },
    beforeDestroy() {
        this.$eventBus.$off('organFd')
    },
    created() {
        this.$eventBus.$on('organFd', res => {
            // console.log(res)
            if(!res.taboneflg){//如果不展示入户调查数据 不查询了
             return;
            }
            this.organFdobj = res
            this.organFdplanId = res.id
            if (res.num === 0) {
                this.riskList = {};
                this.getGetDangerGrid()
            }
        })
    },
    methods: {
        getGetDangerGrid() {
            this.loading = true
            // planId: this.organFdplanId
            const pams = {
                'addvcd': this.organFdobj.addvcd ? this.organFdobj.addvcd : ''
                // 'planId': this.organFdplanId
            }
            GetDangerGrid(pams).then((res) => {
                this.loading = false
                this.riskList = res.data
                this.riskList.dangerArea = Math.floor(this.riskList.dangerArea * 100) / 100
                
            }).catch(err => {

            })
        },
        clickRHCDRow(row,index) {
            // console.log("row",row)
            this.$eventBus.$emit('flyToRHDC', row)
            this.PionId = index
            // this.$viewer.camera.setView({
            //     destination: Cesium.Cartesian3.fromDegrees(row.lgtd, row.lttd, 5000),
            //     orientation: {
            //         heading: Cesium.Math.toRadians(0.0), // east, default value is 0.0 (north)
            //         pitch: Cesium.Math.toRadians(-90), // default value (looking down)
            //         roll: 0.0 // default value
            //     }
            // })
        }
    }
}
</script>
<style lang="less" scoped>

.Fxpg_details {
  display: flex;
  flex-direction: column;
  height: 100%;
  .Fxpg_cur {
    height: 82%;
    flex-shrink: 0;
    background: rgba(3,34,55,0.39);
    overflow: hidden;
    .tableFXPg{
      height: calc(100% - 40px);
        /deep/.el-table__empty-text{
          font-size: 16px;
          font-weight: bold;
          color: #fff;
        }
    }
  }
}
.Submerge {
  color: #ffffff;
  font-size: 12px;
  text-align: center;
  display: -webkit-flex;
  display: flex;
  margin-top: 10px;
  > div {
    width: 25%;
    span {
		font-weight: bold;
    //font-size: 22px;
    font-size: 19px;
		display: block;
		width: 100%;
    height: 80px;
    padding-top:20px;
		// line-height: 60px;
		text-shadow:  0px 0px 9px rgba(188,248,255,0.79);
		background: url("~@/assets/newimg/StatisticsBg.png") no-repeat top center;
    background-size: 90% 100%;
    overflow-wrap: break-word;
    box-sizing: border-box;
    }
  }
}
.riskInfo{
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid #3F72AA;
  padding: 20px 4px 10px;
  .riskInfo_item{
    width: 50%;
    height: 75px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #FFFEFE;
  }
  .inner{
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: start;
    .num{
      font-size: 24px;
      font-family: DIN;
      font-weight: bold;
      color: #00FFFF;
    }
  }
  .riskInfo_item div:nth-child(1){
    width: 50px;
  }
  .riskInfo_item:nth-child(1){
    background: url('~@/assets/newimg/4.png') no-repeat;
    background-size: 90%;
  }
  .riskInfo_item:nth-child(2){
    background: url('~@/assets/newimg/5.png') no-repeat;
    background-size: 90%;
  }
  .riskInfo_item:nth-child(3){
    background: url('~@/assets/newimg/6.png') no-repeat;
    background-size: 90%;
  }
  .riskInfo_item:nth-child(4){
    background: url('~@/assets/newimg/7.png') no-repeat;
    background-size: 90%;
  }
}
</style>
